Skip to content

docs: codify when a comment earns its place - #38618

Open
antiguru wants to merge 1 commit into
mainfrom
docs/comment-rules
Open

docs: codify when a comment earns its place#38618
antiguru wants to merge 1 commit into
mainfrom
docs/comment-rules

Conversation

@antiguru

@antiguru antiguru commented Sep 2, 2026

Copy link
Copy Markdown
Member

Three rules for the code-comment section of AGENTS.md, and one narrowing of a rule already there.

A comment in the compute peek path asserted that PeekResultIterator could not be handed to an async task because the underlying trace reader is not Send. It was wrong. The iterator holds Vec<Tr::Batch> of ArcBatch, never the TraceAgent, and a one-line assert_send probe refutes the claim. The comment was read as fact rather than retested, and the peek stash was built to walk the trace a second time because of it. So a comment asserting a constraint now has to be checked when it is written, by a compile probe, a test, or a pointer to whatever enforces it.

The other two cover what the section left implicit. A sentence earns its place by changing what a maintainer would do, not by being true, and rewording a paragraph while keeping every fact in it is not editing. X rather than Y informs only where Y is what a reader would otherwise assume; elsewhere Y is unconstrained and unfalsifiable, and it rots silently, since the code can move to Y with the sentence still reading correctly. Where Y is a real trap the failure belongs in the comment instead of the contrast, which gives the claim truth conditions a reader can check.

The narrowing is to "why the obvious alternative was not taken", which reads as licence to justify every choice. It now names the alternative a reader would assume, which is the same test the new paragraph applies.

No rule lists banned phrasing. A list of phrases invites working around the list, and the deletion test removes the sentences they live in.

CLAUDE.md is a symlink to AGENTS.md, so the change lands in both.

🤖 Opened by Claude Code on behalf of @antiguru

Three rules the peek-execution work produced, added to the code-comment
section.

A stale comment asserting that `PeekResultIterator` could not be sent to
another thread outlived its truth by months. It was read as fact rather than
retested, and the peek stash was built to walk the trace a second time because
of it. Constraints stated in comments now have to be checked when written.

The other two cover what the section left implicit. A sentence earns its place
by changing what a maintainer would do, not by being true, and rewording a
paragraph while keeping every fact in it is not editing. "X rather than Y"
informs only when Y is what a reader would otherwise assume; elsewhere Y is
unfalsifiable and rots silently, since the code can move to Y with the sentence
still reading correctly.

Also narrows "why the obvious alternative was not taken", which reads as
licence to justify every choice, to the alternative a reader would assume.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant